package com.qyb.util;

import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.pdf.BaseFont;
import fr.opensagres.xdocreport.itext.extension.font.IFontProvider;

import java.awt.*;
import java.io.IOException;

/**
 * <p>
 * 实现功能：
 * <p/>
 *
 * @author 秦有宝
 * @version 1.0.00
 */
public class FontProvider implements IFontProvider {
    @Override
    public Font getFont(String familyName, String encoding, float size, int style, Color color) {
        BaseFont baseFont = null;
        try {
            baseFont = BaseFont.createFont("C:\\Windows\\Fonts\\simhei.ttf",BaseFont.IDENTITY_H,BaseFont.EMBEDDED);
        } catch (DocumentException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Font font = new Font(baseFont);
        return font;
    }
}
